package account.dao.mysql;

import java.sql.SQLException;
import java.util.ArrayList;

import account.dao.AccountDAO;
import account.model.AccountModel;

public class AccountMysqlDAOImpl implements AccountDAO {

	@Override
	public ArrayList<AccountModel> getAccounts() throws SQLException {
		String sql = "select id_account, name, value, period, number, percent, start_date, cost from account";
		return new ModelHelper<AccountModel>().getModel(sql, AccountModel.class);
	}

	@Override
	public AccountModel saveAccount(AccountModel model) throws SQLException {
		ModelHelper< AccountModel > helper = new ModelHelper<AccountModel>();
		ArrayList< AccountModel > models = new ArrayList<AccountModel>();
		models.add(model);
		helper.setModel(models, "account");
		return null;
	}

}
